home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / TUTORIAL / 0855.ZIP / ASSMAC.MAC < prev    next >
Text File  |  1980-01-01  |  36KB  |  564 lines

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                                           ;;
  3. ;;                               ASSEMBLE.MAC                                ;;
  4. ;;                                                                           ;;
  5. ;;            Sample macro library for the IBM PC Macro Assembler            ;;
  6. ;;                                                                           ;;
  7. ;;                            (C) Copyright 1983                             ;;
  8. ;;                                    by                                     ;;
  9. ;;                             Jerry D. Stuckle                              ;;
  10. ;;                                                                           ;;
  11. ;;                         Released to Public Domain                         ;;
  12. ;;                                                                           ;;
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14.  
  15.  
  16.  
  17.  
  18. Clear   Macro   R1,R2,R3,R4,R5,R6,R7,R8
  19. ;;***************************************************************************;;
  20. ;;                                                                           ;;
  21. ;; Macro: Clear                                                              ;;
  22. ;;                                                                           ;;
  23. ;; Description: Clear registers                                              ;;
  24. ;;                                                                           ;;
  25. ;; Paramaters: Up to 8 registers to be cleared                               ;;
  26. ;;                                                                           ;;
  27. ;; Input: N/A                                                                ;;
  28. ;;                                                                           ;;
  29. ;; Output: Requested registers set to binary 0's                             ;;
  30. ;;                                                                           ;;
  31. ;; Registers Used: None                                                      ;;
  32. ;;                                                                           ;;
  33. ;;***************************************************************************;;
  34.         Irp     Rx,<R1,R2,R3,R4,R5,R6,R7,R8>    ;Register list
  35.         Ifnb    <Rx>                            ;For each register in list
  36.         Xor     Rx,Rx                           ;Clear the register
  37.         Endif                                   ;End of Ifidn
  38.         Endm                                    ;End of Irp
  39.         Endm                                    ;Macro end
  40. Cls     Macro
  41.         Local   Cls1,Clsd
  42. ;;***************************************************************************;;
  43. ;;                                                                           ;;
  44. ;; Macro: Cls                                                                ;;
  45. ;;                                                                           ;;
  46. ;; Description: Clear the display screen                                     ;;
  47. ;;                                                                           ;;
  48. ;; Paramaters: None                                                          ;;
  49. ;;                                                                           ;;
  50. ;; Input: None                                                               ;;
  51. ;;                                                                           ;;
  52. ;; Output: None                                                              ;;
  53. ;;                                                                           ;;
  54. ;; Registers Used: AX,DX                                                     ;;
  55. ;;                                                                           ;;
  56. ;;***************************************************************************;;
  57.         Display Clsd                            ;Display the Dos2 String
  58.         Jmp     Short Cls1                      ;Go around the string data
  59. Clsd    Db      1bh,'[2J$'                      ;Data for Dos Call
  60. Cls1    Label   Near
  61.         Endm
  62. Color   Macro   Foreground,Background
  63.         Local   Cold,Col1
  64. ;;***************************************************************************;;
  65. ;;                                                                           ;;
  66. ;; Macro: Color                                                              ;;
  67. ;;                                                                           ;;
  68. ;; Description: Sets display color                                           ;;
  69. ;;                                                                           ;;
  70. ;; Paramaters: Foreground Color, Background Color                            ;;
  71. ;;                                                                           ;;
  72. ;; Input: None                                                               ;;
  73. ;;                                                                           ;;
  74. ;; Output: None                                                              ;;
  75. ;;                                                                           ;;
  76. ;; Registers Used: AX,DX                                                     ;;
  77. ;;                                                                           ;;
  78. ;;***************************************************************************;;
  79.         Display Cold                            ;Display the color string
  80.         Jmp     Short Col1                      ;Go around the string
  81. Cold    Db      1bh,'['                         ;Start of string
  82.         Ifidn   <Foreground>,<Normal>           ;If normal request
  83.         Db      '0'                             ;Normal Foreground
  84.         Else
  85.         Ifidn   <Foreground>,<Bold>             ;If Bold Request
  86.         Db      '1'                            ;Bold Foreground
  87.         Else
  88.         Ifidn   <Foreground>,<Underscore>       ;If Underscored
  89.         Db      '4'                             ;Underscore Foreground
  90.         Else
  91.         Ifidn   <Foreground>,<Blink>            ;If Blink request
  92.         Db      '5'                             ;Blink Foreground
  93.         Else
  94.         Ifidn   <Foreground>,<Reverse>          ;If Reverse request
  95.         Db      '7'                             ;Reverse Video
  96.         Else
  97.         Ifidn   <Foreground>,<Invisible>        ;If Invisable Request
  98.         Db      '8'                             ;Invisable (No-Show)
  99.         Else
  100.         Ifidn   <Foreground>,<Black>            ;If Black Request
  101.         Db      '30'                            ;Black Foreground
  102.         Else
  103.         Ifidn   <Foreground>,<Red>              ;If Red Request
  104.         Db      '31'                            ;Red Foreground
  105.         Else
  106.         Ifidn   <Foreground>,<Green>            ;If Green Request
  107.         Db      '32'                            ;Green Foreground
  108.         Else
  109.         Ifidn   <Foreground>,<Yellow>           ;If Yellow Request
  110.         Db      '33'                            ;Yellow Foreground
  111.         Else
  112.         Ifidn   <Foreground>,<Blue>             ;If Blue Request
  113.         Db      '34'                            ;Blue Foreground
  114.         Else
  115.         Ifidn   <Foreground>,<Magenta>          ;If Magenta Request
  116.         Db      '35'                            ;Magenta Foreground
  117.         Else
  118.         Ifidn   <Foreground>,<Cyan>             ;If Cyan Request
  119.         Db      '36'                            ;Cyan Foreground
  120.         Else
  121.         Ifidn   <Foreground>,<White>            ;If White Request
  122.         Db      '37'                            ;White Foreground
  123.         Endif
  124.         Endif
  125.         Endif
  126.         Endif
  127.         Endif
  128.         Endif
  129.         Endif
  130.         Endif
  131.         Endif
  132.         Endif
  133.         Endif
  134.         Endif
  135.         Endif
  136.         Endif
  137.         Ifnb    <Foreground>                    ;If we have foreground...
  138.         Ifnb    <Background>                    ;And background colors
  139.         Db      ';'                             ;Put in a Seperator
  140.         Endif
  141.         Endif
  142.         Ifidn   <Background>,<Black>            ;If Black Request
  143.         Db      '40'                            ;Black Background
  144.         Else
  145.         Ifidn   <Background>,<Red>              ;If Red Request
  146.         Db      '41'                            ;Red Background
  147.         Else
  148.         Ifidn   <Background>,<Green>            ;If Green Request
  149.         Db      '42'                            ;Green Background
  150.         Else
  151.         Ifidn   <Background>,<Yellow>           ;If Yellow Request
  152.         Db      '43'                            ;Yellow Background
  153.         Else
  154.         Ifidn   <Background>,<Blue>             ;If Blue Request
  155.         Db      '44'                            ;Blue Background
  156.         Else
  157.         Ifidn   <Background>,<Magenta>          ;If Magenta Request
  158.         Db      '45'                            ;Magenta Background
  159.         Else
  160.         Ifidn   <Background>,<Cyan>             ;If Cyan Request
  161.         Db      '46'                            ;Cyan Background
  162.         Else
  163.         Ifidn   <Background>,<White>            ;If White Request
  164.         Db      '47'                            ;White Background
  165.         Endif
  166.         Endif
  167.         Endif
  168.         Endif
  169.         Endif
  170.         Endif
  171.         Endif
  172.         Endif
  173. Col1    Label   Near                            ;Skip around data
  174.         Endm
  175. Cursor  Macro   Function,Area
  176. ;;***************************************************************************;;
  177. ;;                                                                           ;;
  178. ;; Macro: Cursor                                                             ;;
  179. ;;                                                                           ;;
  180. ;; Description: Save or set current cursor type, blank cursor on screen      ;;
  181. ;;                                                                           ;;
  182. ;; Paramaters: Function (Save,Set or Erase), Data or Data address            ;;
  183. ;;                                                                           ;;
  184. ;; Input: Cursor start and end lines (Set only)                              ;;
  185. ;;                                                                           ;;
  186. ;; Output: Cursor start and end lines (Save only)                            ;;
  187. ;;                                                                           ;;
  188. ;; Registers Used: AX,CX  (DS used and restored)                             ;;
  189. ;;                                                                           ;;
  190. ;;***************************************************************************;;
  191.         Ifidn   <Function>,<Erase>              ;If cursor erase requested
  192.         Mov     AH,1                            ;Set cursor mode
  193.         Mov     CX,0F0FH                        ;Start and end on line 15
  194.         Int     10h                             ;Go do a video interrupt
  195.         Else
  196.         Ifidn   <Function>,<Save>               ;If cursor save request
  197.         Push    DS                              ;Save DS
  198.         Mov     AX,40h                          ;Get segment 40h in AX
  199.         Mov     DS,AX                           ;And put it in DS
  200.         Mov     CX,DS:60h                       ;Get current cursor mode
  201.         Pop     DS                              ;Restore DS
  202.         Mov     Area,CX                         ;And move cursor mode to Area
  203.         Else
  204.         Ifidn   <Function>,<Set>                ;If cursor set request
  205.         Mov     CX,Area                         ;Get cursor mode in CX
  206.         Mov     AH,1                            ;Set cursor mode
  207.         Int     10h                             ;Go do video interrupt
  208.         Endif
  209.         Endif
  210.         Endif
  211.         Endm
  212. Cvd     Macro   Dest,Org
  213.         Local   Cvbp,Cvde
  214. ;;***************************************************************************;;
  215. ;;                                                                           ;;
  216. ;; Macro: Cvd                                                                ;;
  217. ;;                                                                           ;;
  218. ;; Description: Convert binary number to  Ascii decimal number               ;;
  219. ;;                                                                           ;;
  220. ;; Paramaters: Output Label, Input Label                                     ;;
  221. ;;                                                                           ;;
  222. ;; Input: Word binary number                                                 ;;
  223. ;;                                                                           ;;
  224. ;; Output: 4 Byte decimal number                                             ;;
  225. ;;                                                                           ;;
  226. ;; Registers Used: AX,BX,DX,DI                                               ;;
  227. ;;                                                                           ;;
  228. ;;***************************************************************************;;
  229.         Ifdif   <Org>,<AX>                      ;If binary value not in AX
  230.         Mov     AX,Word ptr Org                 ;Move origin to AX
  231.         Endif
  232.         Lea     DI,Dest                         ;Get address of destination
  233.         Mov     BL,100d                         ;Divisor to BL
  234.         Div     BL                              ;Divide by 100
  235.         Mov     BH,AH                           ;Save remainder in BH
  236.         Call    Cvdp                            ;Convert highorder  to decimal
  237.         Mov     AL,BH                           ;Get remainder
  238.         Call    Cvdp                            ;Convert low order to decimal
  239.         Jmp     Short Cvde                      ;Jump around proc
  240. Cvdp    Proc    Near
  241.         Aam                                     ;Convert to packed decimal
  242.         Or      AX,3030h                        ;Convert to Ascii
  243.         Mov     [DI],AH                         ;Store high order byte
  244.         Inc     DI                              ;Point to next byte
  245.         Mov     [DI],AL                         ;Store low order byte
  246.         Inc     DI                              ;Point to next byte
  247.         Ret                                     ;Return to caller
  248. Cvdp    Endp
  249. Cvde    Label   Near
  250.         Endm
  251. Display Macro   String
  252. ;;***************************************************************************;;
  253. ;;                                                                           ;;
  254. ;; Macro: Display                                                            ;;
  255. ;;                                                                           ;;
  256. ;; Description: Print an ascii string on the screen                          ;;
  257. ;;                                                                           ;;
  258. ;; Paramaters: Label of string to be printed                                 ;;
  259. ;;                                                                           ;;
  260. ;; Input: Ascii string, ending with a $                                      ;;
  261. ;;                                                                           ;;
  262. ;; Output: None                                                              ;;
  263. ;;                                                                           ;;
  264. ;; Registers Used: AX,DX                                                     ;;
  265. ;;                                                                           ;;
  266. ;;***************************************************************************;;
  267.         Lea     DX,String                       ;Address of string to display
  268.         Doscall 9                               ;Dos Print string function
  269.         Endm
  270. Doscall Macro   Function
  271. ;;***************************************************************************;;
  272. ;;                                                                           ;;
  273. ;; Macro: Doscall                                                            ;;
  274. ;;                                                                           ;;
  275. ;; Description:  Set up and execute requested DOS function call              ;;
  276. ;;                                                                           ;;
  277. ;; Paramaters: Function to be called                                         ;;
  278. ;;                                                                           ;;
  279. ;; Input: None                                                               ;;
  280. ;;                                                                           ;;
  281. ;; Output: None                                                              ;;
  282. ;;                                                                           ;;
  283. ;; Registers Used: AX                                                        ;;
  284. ;;                                                                           ;;
  285. ;;***************************************************************************;;
  286.         Mov     AH,Function                     ;Get function in AH
  287.         Int     21h                             ;Dos Call
  288.         Endm
  289. Getdate Macro   Dest,Type
  290.         Local   Gdte,Gtdp
  291. ;;***************************************************************************;;
  292. ;;                                                                           ;;
  293. ;; Macro: Getdate                                                            ;;
  294. ;;                                                                           ;;
  295. ;; Description: Gets current date into destination                           ;;
  296. ;;                                                                           ;;
  297. ;; Paramaters: Destination, Type of date (Char or Bin)                       ;;
  298. ;;                                                                           ;;
  299. ;; Input: None                                                               ;;
  300. ;;                                                                           ;;
  301. ;; Output: MM/DD/YY (Char) or MDYY (Bin)                                     ;;
  302. ;;                                                                           ;;
  303. ;; Registers Used: AX,BX,CX,DX,DI                                            ;;
  304. ;;                                                                           ;;
  305. ;;***************************************************************************;;
  306.         Ifidn   <Type>,<Char>                   ;If character request
  307.         Doscall 2Ah                             ;Get date function call
  308.         Lea     DI,Dest                         ;Get address of destination
  309.         Mov     AL,DH                           ;Get month in AL
  310.         Call    Gdtp                            ;Convert byte to ascii
  311.         Mov     Word ptr [DI],'/'               ;Move in /
  312.         Inc     DI                              ;Point to next byte
  313.         Mov     AL,DL                           ;Get day in AL
  314.         Call    Gdtp                            ;Convert byte to ascii
  315.         Mov     Word ptr [DI],'/'               ;Move in /
  316.         Inc     DI                              ;Point to next byte
  317.         Mov     AX,CX                           ;Get year in AL
  318.         Mov     BL,100d                         ;Move in divisor
  319.         Div     BL                              ;Divide by 100
  320.         Mov     AL,AH                           ;Remainder to AL
  321.         Call    Gdtp                            ;Convert byte to Ascii
  322.         Jmp     Short Gdte                      ;Jump around proc
  323. Gdtp    Proc    Near
  324.         AAM                                     ;Convert to packed decimal
  325.         Add     AX,3030h                        ;Convert to ASCII
  326.         Mov     Byte ptr [DI],AH                ;Store high order byte
  327.         Inc     DI                              ;Point to next byte
  328.         Mov     Byte Ptr [DI],AL                ;Store low order byte
  329.         Inc     DI                              ;Point to next byte
  330.         Ret                                     ;Return to caller
  331. Gdtp    Endp
  332. Gdte    Label   Near
  333.         Else
  334.         Ifidn   <Type>,<Bin>                    ;If Binary request
  335.         Doscall 2Ah                             ;Get current date
  336.         Mov     Byte ptr Dest,DH                ;Move month to destination
  337.         Mov     Byte ptr [Dest+1],DL            ;Move dat to destination
  338.         Mov     Word ptr [Dest+2],CX            ;Move year to destination
  339.         Endif
  340.         Endif
  341.         Endm
  342. Gettime Macro   Dest,Type
  343.         Local   Gtmp,Gtme
  344. ;;***************************************************************************;;
  345. ;;                                                                           ;;
  346. ;; Macro: Gettime                                                            ;;
  347. ;;                                                                           ;;
  348. ;; Description: Get current time into Destination                            ;;
  349. ;;                                                                           ;;
  350. ;; Paramaters: Destination, Type (Char or Bin)                               ;;
  351. ;;                                                                           ;;
  352. ;; Input: None                                                               ;;
  353. ;;                                                                           ;;
  354. ;; Output: HH:MM:SS:HH (Char) or HMSH (Bin)                                  ;;
  355. ;;                                                                           ;;
  356. ;; Registers Used: AX,BX,CX,DX,DI                                            ;;
  357. ;;                                                                           ;;
  358. ;;***************************************************************************;;
  359.         Ifidn   <Type>,<Char>                   ;If character request
  360.         Doscall 2Ch                             ;Get current time
  361.         Lea     DI,Dest                         ;Get destination address
  362.         Mov     AL,CH                           ;Move hours to AL
  363.         Call    Gtmp                            ;And convert to ASCII
  364.         Mov     Word ptr [DI],':'               ;Put in :
  365.         Inc     DI                              ;Point to next byte
  366.         Mov     AL,CL                           ;Move minutes to AL
  367.         Call    Gtmp                            ;And convert to ASCII
  368.         Mov     Word ptr [DI],':'               ;Put in :
  369.         Inc     DI                              ;Point to next byte
  370.         Mov     AL,DH                           ;Move seconds to AL
  371.         Call    Gtmp                            ;And convert to ASCII
  372.         Mov     Word ptr [DI],':'               ;Put in :
  373.         Inc     DI                              ;Point to next byte
  374.         Mov     AL,DL                           ;Move hundreths to AL
  375.         Call    Gtmp                            ;And convert to ASCII
  376.         Jmp     Short Gtme                      ;Jump around proc
  377. Gtmp    Proc    Near
  378.         AAM                                     ;Convert to packed decimal
  379.         Add     AX,3030h                        ;Convert to ASCII
  380.         Mov     Byte ptr [DI],AH                ;Store high order byte
  381.         Inc     DI                              ;Point to next byte
  382.         Mov     Byte Ptr [DI],AL                ;Store low order byte
  383.         Inc     DI                              ;Point to next byte
  384.         Ret                                     ;Return to caller
  385. Gtmp    Endp
  386. Gtme    Label   Near
  387.         Else
  388.         Ifidn   <Type>,<Bin>                    ;If request for Binary time
  389.         Doscall 2Ch                             ;Get current time
  390.         Mov     Byte ptr Dest,CH                ;Move hours to destination
  391.         Mov     Byte ptr Dest+1,CL              ;Move minutes to destination
  392.         Mov     Byte ptr Dest+2,DH              ;Move seconds to destination
  393.         Mov     Byte ptr Dest+3,DL              ;Move hundreths to destination
  394.         Endif
  395.         Endif
  396.         Endm
  397. Locate  Macro   Row,Column
  398.         Local   Loc1,Locd
  399. ;;***************************************************************************;;
  400. ;;                                                                           ;;
  401. ;; Macro: Locate                                                             ;;
  402. ;;                                                                           ;;
  403. ;; Description: Position Cursor on screen                                    ;;
  404. ;;                                                                           ;;
  405. ;; Paramaters: Row, Column                                                   ;;
  406. ;;                                                                           ;;
  407. ;; Input: Binary row and column location, if not in macro call               ;;
  408. ;;                                                                           ;;
  409. ;; Output: None                                                              ;;
  410. ;;                                                                           ;;
  411. ;; Registers Used: AX,DX                                                     ;;
  412. ;;                                                                           ;;
  413. ;;***************************************************************************;;
  414.         Mov     AL,Row                          ;Get binary row
  415.         Aam                                     ;Convert to packed decimal
  416.         Add     AX,3030h                        ;Convert to Ascii
  417.         Mov     Byte Ptr [Locd+2],AH            ;High order row to string
  418.         Mov     Byte Ptr [Locd+3],AL            ;Low order row to string
  419.         Clear   AH                              ;Clear AH again
  420.         Mov     AL,Column                       ;Get column in AL
  421.         Aam                                     ;Convert to packed decimal
  422.         Add     AX,3030h                        ;Convert to Ascii
  423.         Mov     Byte Ptr [Locd+5],AH            ;High order column to string
  424.         Mov     Byte Ptr [Locd+6],AL            ;Low order column ti string
  425.         Display Locd                            ;Position the cursor
  426.         Jmp     Short Loc1                      ;Jump around string
  427. Locd    Db      1bh,'[  ;  H$'                  ;Position cursor string
  428. Loc1    Label   Near
  429.         Endm
  430. Move    Macro   To,From,Lngth
  431.         Local   Movelp
  432. ;;***************************************************************************;;
  433. ;;                                                                           ;;
  434. ;; Macro: Move                                                               ;;
  435. ;;                                                                           ;;
  436. ;; Description: Multiple byte move                                           ;;
  437. ;;                                                                           ;;
  438. ;; Paramaters: To location, from location, Length (Opt.)                     ;;
  439. ;;                                                                           ;;
  440. ;; Input: Source string                                                      ;;
  441. ;;                                                                           ;;
  442. ;; Output: Destination string                                                ;;
  443. ;;                                                                           ;;
  444. ;; Registers Used: CX,SI,DI (ES assumed pointing to destination segment)     ;;
  445. ;;                                                                           ;;
  446. ;;***************************************************************************;;
  447.         Clear   CH                              ;Clear length reg
  448.         Ifb     <Length>                        ;If no length requested
  449.         Mov     CX,Length To                    ;Use length of to string
  450.         Else                                    ;If length requested
  451.         Mov     CX,Lngth                        ;Use length in macro
  452.         Endif
  453.         Ifdif   <To>,<DI>                       ;If DI not specified for To
  454.         Lea     DI,To                           ;Load To address into DI
  455.         Endif
  456.         Ifdif   <From>,<SI>                     ;If SI not specified for From
  457.         Lea     SI,From                         ;Load From address into SI
  458.         Endif
  459.         Cld                                     ;Clear direction flag
  460.         Rep     Movsb                           ;Move the data
  461.         Endm
  462. Restore Macro   R1,R2,R3,R4,R5,R6,R7,R8,R9,R10
  463. ;;***************************************************************************;;
  464. ;;                                                                           ;;
  465. ;; Macro: Restore                                                            ;;
  466. ;;                                                                           ;;
  467. ;; Description: Restore registers from stack                                 ;;
  468. ;;                                                                           ;;
  469. ;; Paramaters: Registers to be restored (in reverse order)                   ;;
  470. ;;                                                                           ;;
  471. ;; Input: None                                                               ;;
  472. ;;                                                                           ;;
  473. ;; Output: Restored registers                                                ;;
  474. ;;                                                                           ;;
  475. ;; Registers Used: None                                                      ;;
  476. ;;                                                                           ;;
  477. ;;***************************************************************************;;
  478.         Irp     Rx,<R10,R9,R8,R7,R6,R5,R4,R3,R2,R1> ;Repeat for each parm
  479.         Ifnb    <Rx>                            ;If this parm not blank
  480.         Pop     Rx                              ;Pop the register
  481.         Endif                                   ;End Ifnb
  482.         Endm                                    ;End Irp
  483.         Endm
  484. Save    Macro   R1,R2,R3,R4,R5,R6,R7,R8,R9,R10
  485. ;;***************************************************************************;;
  486. ;;                                                                           ;;
  487. ;; Macro: Save                                                               ;;
  488. ;;                                                                           ;;
  489. ;; Description: Save registers on the stack                                  ;;
  490. ;;                                                                           ;;
  491. ;; Paramaters: Registers to be saved                                         ;;
  492. ;;                                                                           ;;
  493. ;; Input: None                                                               ;;
  494. ;;                                                                           ;;
  495. ;; Output: Registers saved on stack                                          ;;
  496. ;;                                                                           ;;
  497. ;; Registers Used: None                                                      ;;
  498. ;;                                                                           ;;
  499. ;;***************************************************************************;;
  500.         Irp     Rx,<R1,R2,R3,R4,R5,R6,R7,R8,R9,R10> ;Repeat for each parm
  501.         Ifnb    <Rx>                            ;If this parm not blank
  502.         Push    Rx                              ;Save the register
  503.         Endif                                   ;End Ifnb
  504.         Endm                                    ;End Irp
  505.         Endm
  506. Setint  Macro   Interrupt,Routine
  507. ;;***************************************************************************;;
  508. ;;                                                                           ;;
  509. ;; Macro: Setint                                                             ;;
  510. ;;                                                                           ;;
  511. ;; Description: Set interrupt vector                                         ;;
  512. ;;                                                                           ;;
  513. ;; Paramaters: Interrupt vector, interrupt routine address                   ;;
  514. ;;                                                                           ;;
  515. ;; Input: None                                                               ;;
  516. ;;                                                                           ;;
  517. ;; Output: None                                                              ;;
  518. ;;                                                                           ;;
  519. ;; Registers Used: AX,DX                                                     ;;
  520. ;;                                                                           ;;
  521. ;;***************************************************************************;;
  522.         Mov     AL,Interrupt                    ;Get interrupt to be set
  523.         Lea     DX,Routine                      ;Get address of routine
  524.         Doscall 25h                             ;Call DOS
  525.         Endm
  526. Settime Macro   Hours,Minutes,Seconds,Hundreths
  527. ;;***************************************************************************;;
  528. ;;                                                                           ;;
  529. ;; Macro: Settime                                                            ;;
  530. ;;                                                                           ;;
  531. ;; Description: Set current time                                             ;;
  532. ;;                                                                           ;;
  533. ;; Paramaters: Hours, Minutes, Seconds,Hundreths                             ;;
  534. ;;                                                                           ;;
  535. ;; Input: Time to be set                                                     ;;
  536. ;;                                                                           ;;
  537. ;; Output: None                                                              ;;
  538. ;;                                                                           ;;
  539. ;; Registers Used: AX,CX,DX                                                  ;;
  540. ;;                                                                           ;;
  541. ;;***************************************************************************;;
  542.         Ifnb    <Hours>                         ;If hours specified
  543.         Mov     CH,Hours                        ;Move hours to CH
  544.         Else                                    ;If hours not specified
  545.         Clear   CH                              ;Clear CH
  546.         Endif
  547.         Ifnb    <Minutes>                       ;If minutes specified
  548.         Mov     CL,Minutes                      ;Move minutes to CL
  549.         Else                                    ;If minutes not specified
  550.         Clear   CL                              ;Clear CL
  551.         Endif
  552.         Ifnb    <Seconds>                       ;If seconds specified
  553.         Mov     DH,Seconds                      ;Move seconds to DH
  554.         Else                                    ;If seconds not specified
  555.         Clear   DH                              ;Clear DH
  556.         Endif
  557.         Ifnb    <Hundreths>                     ;If hundreths specified
  558.         Mov     DL,Hundreths                    ;Move hundreths to DL
  559.         Else                                    ;If hndreths not specified
  560.         Clear   DL                              ;Clear DL
  561.         Endif
  562.         Doscall 2dh                             ;Call DOS to set time
  563.         Endm
  564.